//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    tou:"邀请函",
    phone:"王辉辉",
    phone1:"张玲玲",
    invite:"我们诚邀您来参加我们的婚礼",
    time:"2019年1月21日",
    site:"北京市海淀区东南路京都府酒店",

    isPlayingMusic:false
  },
  
  bgm: null,
  // http://music.163.com/song/media/outer/url?id=476592630.mp3
  // http://sc1.111ttt.cn/2014/1/08/09/1092105331.mp3
  music_url: 'http://sc1.111ttt.cn/2014/1/08/09/1092105331.mp3',
  music_coverImgUrl: '../images/bi.jpg',
  onReady: function () {
    this.bgm = wx.getBackgroundAudioManager()
    this.bgm.title = 'marry me'
    this.bgm.epname = 'weding'
    this.bgm.singer = 'singer'
    this.bgm.music_coverImgUrl = this.music_coverImgUrl
    this.bgm.onCanplay(() => {
      this.bgm.pause()
    })
    this.bgm.src = this.music_url
  },
  play:function(e){
    if(this.data.isPlayingMusic){
      this.bgm.pause()
    }else{
      this.bgm.play()
    }
    this.setData({
      isPlayingMusic:!this.data.isPlayingMusic
    })
  },
  callGroom:function(){
    wx.makePhoneCall({
      phoneNumber: '11111111111',
    })
  },
  callBride:function(){
    wx.makePhoneCall({
      phoneNumber: '23242354325',
    })
  },
})

  

